package cn.demo.text.editor.strategy.menu;

import cn.demo.text.editor.constant.Str;

import javax.swing.*;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;

public class SaveMenuItem extends JMenuItem {

    public SaveMenuItem(ActionListener actionListener) {
        super(Str.SAVE, null);
        this.addActionListener(actionListener);
        this.setActionCommand(Str.SAVE);
        this.setFont(new MenuFont());
        this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK));
    }
}